home *** CD-ROM | disk | FTP | other *** search
- /*
- File: HexBrowserAPI.h
-
- Hex Section Browser Plug-in Interface
-
- Version: 1.0
- Date: October 2000
-
- Copyright © 1998-2000 Dan Wright, All rights reserved.
-
- Bugs?: Please include the name of this file, the version, and the date (above).
- Send bug reports to danwr@kagi.com.
-
- Updates: http://www.halcyon.com/danwr/smoothie.html
- */
-
- #ifndef __HEXBROWSERAPI__
- #define __HEXBROWSERAPI__
-
-
- #if PRAGMA_ONCE
- #pragma once
- #endif
-
- enum {
- kSigPluginHexBrowser = FOUR_CHAR_CODE('Hex$'),
-
- kCmdNothing = 0,
- kCmdBrowseData = 1,
- kCmdBrowseCode = 2,
- kCmdBrowseLoader = 3
-
- };
-
-
- enum {
- kNoReloc = 0, // data is data is data
- kSect1Reloc, // relative to address of specified section
- kSect2Reloc,
- kSect3Reloc,
- kSect4Reloc,
- kSect5Reloc,
- kSect6Reloc,
- kImportReloc, // data is to be replaced by the address of an imported symbol (prgb gets index of symbol)
-
- kFirstByteMask = 8 // data is the first (high byte) of value
- };
-
-
- #define sectReloc(isect) (kSect1Reloc + (isect))
- #define sectReloc32(isect) (((kSect1Reloc + isect) * 0x01010101) | (kFirstByteMask << 24))
- #define import32 ((kImportReloc * 0x01010101) | (kFirstByteMask << 24))
- #define isectFromReloc(relocB) (((relocB) & 7) - 1)
-
-
-
- typedef pascal WindowPtr (*HexFindFragmentBrowserProcPtr)(FragmentRef, SInt8);
- typedef pascal WindowPtr (*HexFindLocatorBrowserProcPtr)(ConstFrazLocatorPtr, SInt8);
- typedef pascal Boolean (*HexGotoFragmentOffsetProcPtr)(FragmentRef, UInt8, UInt32);
- typedef pascal Boolean (*HexGotoLocatorOffsetProcPtr)(ConstFrazLocatorPtr, UInt8, UInt32);
- typedef pascal SInt32 (*HexGetOffsetInfoProcPtr)(ConstFrazLocatorPtr, UInt8, UInt32, Size, Ptr, Ptr);
- typedef pascal Boolean (*HexFindReferencesProcPtr)(ConstFrazLocatorPtr, SInt8, UInt8, UInt32, UInt32, UInt32 *, UInt32 *);
- typedef pascal SInt32 (*HexFindTextProcPtr)(ConstFrazLocatorPtr, SInt8, SInt32, char *, UInt32);
- typedef pascal SInt32 (*HexFindHexProcPtr)(ConstFrazLocatorPtr, SInt8, SInt32, char *, UInt32);
-
-
- /* note on section parameter:
- If section >= 0, it represents the sectionKind (see PEFBinaryFormat.h);
- if section < 0, it is a negative, one-based index [that is, -(isect + 1) ] */
- pascal WindowPtr HexFindLocatorBrowser(ConstFrazLocatorPtr plocator, SInt8 section);
- pascal WindowPtr HexFindBrowser(FragmentRef fragment, SInt8 section);
- pascal WindowPtr HexOpenSectionBrowser(ConstFrazLocatorPtr plocator, ConstStringPtr stFragmentName, SInt8 section);
- pascal Boolean HexGotoLocatorOffset(ConstFrazLocatorPtr plocator, SInt8 section, UInt32 offset);
- pascal Boolean HexGotoOffset(FragmentRef fragment, SInt8 section, UInt32 offset);
- pascal SInt32 HexGetOffsetInfo(ConstFrazLocatorPtr plocator, SInt8 section, UInt32 offset, Size cbMax, Ptr prgb, Ptr prgreloc);
-
- pascal Boolean HexGetImportName(ConstFrazLocatorPtr plocator, SInt8 section, SInt32 isym, StringPtr pstSymbol);
-
- pascal SInt32 HexFindText(ConstFrazLocatorPtr plocator, SInt8 section, SInt32 startingOffset, char *text, UInt32 cch);
- pascal SInt32 HexFindHex(ConstFrazLocatorPtr plocator, SInt8 section, SInt32 startingOffset, char *text, UInt32 cch);
-
- pascal Boolean HexFindReferences(ConstFrazLocatorPtr plocator, SInt8 section,
- UInt8 sectionTarget, UInt32 offsetTarget,
- UInt32 crefMax,
- UInt32 *prgRefOffsets,
- UInt32 *pcRefs);
-
- #endif /* __HEXBROWSERAPI__ */